/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.jr2tecnologia.model.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author ronildo
 */
@Entity
@Table(name = "modem")
@NamedQueries({
    @NamedQuery(name = "Modem.findAll", query = "SELECT m FROM Modem m order by m.pkModem"),
    @NamedQuery(name = "Modem.findByPkModem", query = "SELECT m FROM Modem m WHERE m.pkModem = :pkModem"),
    @NamedQuery(name = "Modem.findByName", query = "SELECT m FROM Modem m WHERE m.name = :name"),
    @NamedQuery(name = "Modem.findBySmscRoute", query = "SELECT m FROM Modem m WHERE m.smscRoute = :smscRoute"),
    @NamedQuery(name = "Modem.findByPhone", query = "SELECT m FROM Modem m WHERE m.phone = :phone"),
    @NamedQuery(name = "Modem.findByWorking", query = "SELECT m FROM Modem m WHERE m.working = :working")})
public class Modem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "pk_modem")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seq_modem")
    @SequenceGenerator(name="seq_modem", sequenceName="seq_modem", allocationSize=1)
    private Long pkModem;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "smsc_route")
    private String smscRoute;
    @Basic(optional = false)
    @Column(name = "phone")
    private String phone;
    @Basic(optional = false)
    @Column(name = "working")
    private Boolean working;
    @Column(name = "next")
    private Boolean next;
    @JoinColumn(name = "fk_login", referencedColumnName = "pk_login")
    @ManyToOne
    private Login login;
    @JoinColumn(name = "fk_company", referencedColumnName = "pk_company")
    @ManyToOne
    private Company company;
    @JoinColumn(name = "fk_carrier", referencedColumnName = "pk_carrier")
    @ManyToOne(optional = false)
    private Carrier carrier;
    @OneToMany(mappedBy = "modem")
    private List<SmsSend> smsSendList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "modem")
    private List<SmsReceived> smsReceivedList;

    public Modem() {
    }

    public Modem(Long pkModem) {
        this.pkModem = pkModem;
    }

    public Modem(Login login, Boolean working) {
        this.login = login;
        this.working = working;
    }

    public Modem(Company company, Boolean working) {
        this.company = company;
        this.working = working;
    }

    public Modem(Company company, Login login, Carrier carrier) {
        this.company = company;
        this.login = login;
        this.carrier = carrier;
    }

    public Modem(Long pkModem, String name, String smscRoute, String phone, Boolean working) {
        this.pkModem = pkModem;
        this.name = name;
        this.smscRoute = smscRoute;
        this.phone = phone;
        this.working = working;
    }

    public Long getPkModem() {
        return pkModem;
    }

    public void setPkModem(Long pkModem) {
        this.pkModem = pkModem;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSmscRoute() {
        return smscRoute;
    }

    public void setSmscRoute(String smscRoute) {
        this.smscRoute = smscRoute;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Boolean getWorking() {
        return working;
    }

    public void setWorking(Boolean working) {
        this.working = working;
    }

    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public Carrier getCarrier() {
        return carrier;
    }

    public void setCarrier(Carrier carrier) {
        this.carrier = carrier;
    }

    public List<SmsSend> getSmsSendList() {
        return smsSendList;
    }

    public void setSmsSendList(List<SmsSend> smsSendList) {
        this.smsSendList = smsSendList;
    }

    public List<SmsReceived> getSmsReceivedList() {
        return smsReceivedList;
    }

    public void setSmsReceivedList(List<SmsReceived> smsReceivedList) {
        this.smsReceivedList = smsReceivedList;
    }

    public Boolean getNext() {
        return next;
    }

    public void setNext(Boolean next) {
        this.next = next;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pkModem != null ? pkModem.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Modem)) {
            return false;
        }
        Modem other = (Modem) object;
        if ((this.pkModem == null && other.pkModem != null) || (this.pkModem != null && !this.pkModem.equals(other.pkModem))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.jr2tecnologia.model.entity.Modem[pkModem=" + pkModem + "]";
    }

}
